//
//  DLDataWifiInfoView.m
//  AllPass
//
//  Created by apple on 2021/11/4.
//

#import "DLDataWifiInfoView.h"
@interface DLDataWifiInfoView()

@end
@implementation DLDataWifiInfoView

- (instancetype)initWithFrame:(CGRect)frame content:(NSString*)c
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = UIColorYellow;
        [self createUI:c];
    }
    return self;
}
-(void)breakClick{
    if ([self.delegate respondsToSelector:@selector(breakWifi:)]) {
        [self.delegate breakWifi:self];
    }
}
-(void)createUI:(NSString*)c{
    UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
    [btn setImage:Image(@"断开连接") forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(breakClick) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:btn];
    btn.sd_layout.rightSpaceToView(self, 10).centerYEqualToView(self).offset(kStatusBarHeight/2.0).widthIs(45).heightEqualToWidth();
    
    UILabel * lab = [UILabel labelWithTitle:c color:TextColor fontSize:15 alignment:NSTextAlignmentLeft];
    [self addSubview:lab];
    lab.sd_layout.leftSpaceToView(self, 10).centerYEqualToView(self).offset(kStatusBarHeight/2.0).rightSpaceToView(btn, 10).autoHeightRatio(0);
}
@end
